﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLDBHYT.DAO;
using QLDBHYT.VO;
using System.Data;
using System.Data.SqlClient;


namespace QLDBHYT.BUS
{
    public class NhomPCBUS
    {
        private NhomCPDAO nhomPCDAO;
        /// <constructor>
        /// Constructor VatLieuBUS
        /// </constructor>
        ///  /// <constructor>
            /// Constructor VatLieuBUS
            /// </constructor>
        public NhomPCBUS()
        {
            nhomPCDAO = new NhomCPDAO();
        }
        public List<NhomCPVO> GetListNhomPC()
        {
            List<NhomCPVO> lstNhomPC = new List<NhomCPVO>();
            NhomCPVO nhomCPVO;
            DataTable dataTable = new DataTable();
            dataTable = nhomPCDAO.SearchAll();
            foreach (DataRow dr in dataTable.Rows)
            {
                nhomCPVO = new NhomCPVO();
                nhomCPVO.Tennh = dr["ten_nh"].ToString();
                nhomCPVO.Sttnh = dr["Stt_nh"].ToString();
                lstNhomPC.Add(nhomCPVO);

            }
            return lstNhomPC;
        }
        public List<KyVO> GetListKy()
        {
            List<KyVO> lstKy = new List<KyVO>();
            KyVO kyVO;
            DataTable dataTable = new DataTable();
            dataTable = nhomPCDAO.SearchKy();
            foreach (DataRow dr in dataTable.Rows)
            {
                kyVO = new KyVO();
                kyVO.Thangnam = Convert.ToInt32(dr["Thang"]).ToString() + Convert.ToInt32(dr["Nam"]).ToString();
                kyVO.Thang = Convert.ToInt32(dr["Thang"]);
                kyVO.Nam  = Convert.ToInt32(dr["Nam"]);
                kyVO.Ky = Convert.ToInt32(dr["ky"]);
                lstKy.Add(kyVO);

            }
            return lstKy;
        }
    }
}
